{% extends "master.html" %}
{% block subtitle %} - 修改用户资料{% endblock %}

{% block extJS %}
<script language="JavaScript" type="text/javascript">
//<![CDATA[
    function toSubmit(){
        var msg = [];
        clearMsg();
        $(".err").removeClass('err');
        
        
        if(msg.length > 0){
            alertError(msg);        
            return false;            
        }else{
            $("form").submit();
        }
            
    }
    
    function toCancel(){
        redirect_alert('{{MSG_LEAVE_WITHOUT_SAVING}}',"{{url_for('bpRoot.view')}}");
    }
//]]>
</script>
{% endblock %}

{% block main %}
<div class="container">
    <div class="row">
        <ol class="breadcrumb">
          <li><a href="#">用户</a></li>
          <li class="active">用户资料</li>
        </ol>
    </div>
    <ul class="nav nav-tabs">
      <li class="active"><a href="#">用户资料</a></li>
      <li><a href="{{url_for('bpAuth.changePW')}}">修改密码</a></li>
      <li><a href="{{url_for('bpAuth.viewLog')}}">日志记录</a></li>
    </ul>
    <div class="row">
        <div class="btn-toolbar pull-right">
            <div class="btn-group"><button class="btn btn-primary" onclick="return toSubmit()">确认</button></div>
            <div class="btn-group"><button class="btn btn-default" onclick="return toCancel()">取消</button></div>
        </div>
    </div>
    <div class="row">
        <div class="col-md-3">
            <ul class="img-thumbnails">
              <li class="col-md-3">
                <div class="img-thumbnail">
                  {% if obj.imageURL %}
                      <img data-src="" alt="" style="width: 160px; height: 120px;" src="{{obj.imageURL}}">
                  {% else %}
                      <img data-src="" alt="" style="width: 160px; height: 120px;" src="">
                  {% endif %}
                </div>
              </li>
            </ul>
        </div>
        <div class="col-md-9">
            <form class="form-horizontal" action="{{url_for('bpAuth.changePro')}}" method="post"  enctype="multipart/form-data">
                <div class="control-group">
                    <label class="control-label" for="name">用户名</label>
                    <div class="controls">
                      <input type="text" id="name" placeholder="用户名" name="name" value="{{obj.name}}" readonly="true">
                    </div>
                </div>
                
                <div class="control-group">
                    <label class="control-label" for="email">电子邮件</label>
                    <div class="controls">
                      <input type="text" id="email" placeholder="电子邮件" name="email" value="{{obj.email|f}}">
                    </div>
                </div>
                
                <div class="control-group">
                    <label class="control-label" for="phone">电话</label>
                    <div class="controls">
                      <input type="text" id="phone" placeholder="电话" name="phone" value="{{obj.phone|f}}">
                    </div>
                </div>
                
                <div class="control-group">
                    <label class="control-label" for="mobile">手机</label>
                    <div class="controls">
                      <input type="text" id="mobile" placeholder="手机" name="mobile" value="{{obj.mobile|f}}">
                    </div>
                </div>
                
                <div class="control-group">
                    <label class="control-label" for="mobile">头像</label>
                    <div class="controls">
                      <input type="file" id="imageURL" placeholder="头像" name="imageURL" value="">
                    </div>
                </div>
                
          </form>
        </div>
    </div>
</div>
{% endblock %}
